package com.qf.erpb.login.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qf.erpb.login.dao.AdminDao;
import com.qf.erpb.login.entity.Admin;
import com.qf.erpb.login.service.AdminService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * (Admin)表服务实现类
 *
 * @author makejava
 * @since 2023-12-18 16:09:36
 */
@Service("adminService")
public class AdminServiceImpl implements AdminService {

@Resource
private AdminDao adminDao;

    @Override
    public String login(Admin admin) {
        Admin a = adminDao.selectOne(new LambdaQueryWrapper<Admin>().eq(Admin::getUsername, admin.getPassword()));
        if (a == null) {
            throw new RuntimeException("用户名错误");
        }
        if (!a.getPassword().equals(admin.getPassword())) {
            throw new RuntimeException("密码错误");
        }
        return null;

    }
}
